package main

import (
	"fmt"
)

func main() {
	// 字符属于int类型

	var c0 byte = 'a'
	fmt.Printf("c1 %c, %v type %T\n", c0, c0, c0)

	var c1 rune = '中'
	fmt.Printf("c1 %c, %v type %T\n", c1, c1, c1)

	var str1 = "12345你好"
	fmt.Printf("str %v type %T, size %d\n", str1, str1, len(str1))
	fmt.Println("----------------------------------------------")
	var str2 = "12345你好"

	for i := 0; i < len(str2); i++ { //byte
		fmt.Printf("%c %v\n", str2[i], str2[i])
	}
	fmt.Println("----------------------------------------------")
	for idx, val := range str2 { //rune
		fmt.Printf("%d %v %c\n", idx, val, val)
	}
	fmt.Println("----------------------------------------------")
	str3 := "big"
	bytes3 := []byte(str3)
	bytes3[0] = 'p'
	fmt.Println(string(bytes3))

	str4 := "big国"
	bytes4 := []rune(str4)
	bytes4[3] = '没'
	fmt.Println(string(bytes4))
}
